import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RouteRecordRaw } from 'vue-router';

const data = {
  code: 200,
  msg: '操作成功',
  data: [
    {
      name: 'Project',
      path: '/project',
      hidden: false,
      redirect: 'noRedirect',
      component: 'Layout',
      alwaysShow: true,
      meta: {
        title: '项目管理',
        icon: 'dict',
        noCache: false,
        link: null
      },
      children: [
        {
          name: 'ProjectList',
          path: 'projectList',
          hidden: false,
          component: 'project/projectList/index',
          meta: {
            title: '项目发布',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        },
        {
          name: 'ProjectDetail',
          path: 'projectDetail',
          hidden: true,
          redirect: 'noRedirect',
          component: 'project/projectList/Detail',
          meta: {
            keepAlive: false,
            internalOrExternal: false,
            title: '项目详情',
            breadcrumb: false
          }
        },
        {
          name: 'SubTaskApproval',
          path: 'subTaskApproval',
          hidden: true,
          redirect: 'noRedirect',
          component: 'project/deliveryAudit/subTaskApproval/index',
          meta: {
            keepAlive: false,
            internalOrExternal: false,
            title: '子项目审核',
            breadcrumb: false
          }
        },
        {
          name: 'ProjectReceving',
          path: 'projectReceving',
          hidden: false,
          component: 'project/projectReceving/index',
          meta: {
            title: '接单审核',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        },
        {
          name: 'DeliveryAudit',
          path: 'deliveryAudit',
          hidden: false,
          component: 'project/deliveryAudit/index',
          meta: {
            title: '交付审核',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        }
      ]
    },
    {
      name: 'EmploymentManagement',
      path: '/employmentManagement',
      hidden: false,
      redirect: 'noRedirect',
      component: 'Layout',
      alwaysShow: true,
      meta: {
        title: '用工管理',
        icon: 'peoples',
        noCache: false,
        link: null
      },
      children: [
        {
          name: 'EmploymentContract',
          path: 'employmentContract',
          hidden: false,
          component: 'employmentManagement/employmentContract/index',
          meta: {
            title: '用工签约',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        },
        {
          name: 'EmploymentContract2',
          path: 'employmentContract2',
          hidden: false,
          component: 'employmentManagement/employmentContract/index2',
          meta: {
            title: '用工信息',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        },
        {
          name: 'BusinessTaxRegistration',
          path: 'businessTaxRegistration',
          hidden: false,
          component: 'employmentManagement/businessTaxRegistration/index',
          meta: {
            title: '工商税务登记',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        }
      ]
    },
    {
      name: 'SettlementManagement',
      path: '/settlementManagement',
      hidden: false,
      redirect: 'noRedirect',
      component: 'Layout',
      alwaysShow: true,
      meta: {
        title: '结算管理',
        icon: 'money',
        noCache: false,
        link: null
      },
      children: [
        {
          name: 'SettlementPayment',
          path: 'settlementPayment',
          hidden: false,
          component: 'settlementManagement/settlementPayment/index',
          meta: {
            title: '结算付款',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        },
        {
          name: 'PaymentApproval',
          path: 'paymentApproval',
          hidden: false,
          component: 'settlementManagement/paymentApproval/index',
          meta: {
            title: '出款审批',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        },
        {
          name: 'ApprovalDetail',
          path: 'approvalDetail',
          hidden: true,
          redirect: 'noRedirect',
          component: 'settlementManagement/paymentApproval/Detail',
          meta: {
            keepAlive: false,
            internalOrExternal: false,
            title: '详情',
            breadcrumb: false
          }
        },
        {
          name: 'AgencyPaymentDetails',
          path: 'agencyPaymentDetails',
          hidden: false,
          component: 'settlementManagement/agencyPaymentDetails/index',
          meta: {
            title: '代发明细查询',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        }
      ]
    },
    {
      name: 'Account',
      path: '/account',
      hidden: false,
      redirect: 'noRedirect',
      component: 'Layout',
      alwaysShow: true,
      meta: {
        title: '账户管理',
        icon: 'peoples',
        noCache: false,
        link: null
      },
      children: [
        {
          name: 'balance',
          path: 'balance',
          hidden: false,
          component: 'account/balance/index',
          meta: {
            title: '账户余额',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        },
        {
          name: 'TradeLog',
          path: 'tradeLog',
          hidden: false,
          component: 'account/tradeLog/index',
          meta: {
            title: '交易流水',
            icon: 'logininfor',
            noCache: false,
            link: null
          }
        }
      ]
    },
    {
      name: 'System',
      path: '/system',
      hidden: false,
      redirect: 'noRedirect',
      component: 'Layout',
      alwaysShow: true,
      meta: {
        title: '系统管理',
        icon: 'system',
        noCache: false,
        link: null
      },
      children: [
        {
          name: 'MerchantInfo',
          path: 'merchantInfo',
          hidden: false,
          component: 'system/merchantInfo/index',
          meta: {
            title: '企业信息',
            icon: 'checkbox',
            noCache: false,
            link: null
          }
        },
        {
          name: 'LoginTypeChoose',
          path: 'loginTypeChoose',
          hidden: false,
          component: 'system/loginTypeChoose/index',
          meta: {
            title: '登录方式选择',
            icon: 'checkbox',
            noCache: false,
            link: null
          }
        }
      ]
    }
  ]
};

// 获取路由
export function getRouters(): AxiosPromise<RouteRecordRaw[]> {
   // return Promise.resolve(data);
  return request({
    url: '/system/menu/getRouters',
    method: 'get'
  });
}
